//
//  XSNavigationViewController.swift
//  WeiDo
//
//  Created by XISHAN on 16/3/2.
//  Copyright © 2016年 XISHAN. All rights reserved.
//

import UIKit



class XSNavigationViewController: UINavigationController {

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    override func pushViewController
        (viewController: UIViewController, animated: Bool) {
            
            if childViewControllers.count > 0 {
                
                viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(imageName: "navigationbar_back_withtext", title: "返回", target: self, action: "back")
                viewController.hidesBottomBarWhenPushed = true
            }
        super.pushViewController(viewController, animated: true)
    }
    
    func back(){
        
        popViewControllerAnimated(true)
    }
    
    

    
}
